<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改业务类型</title>
    {% load static %}
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/css/oksub.css">
    <script type="text/javascript" src="/static/lib/loading/okLoading.js"></script>
    <script src="/static/lib/layui/layui.js"></script>

    <link type="text/css" rel="stylesheet" href="/static/css/metroStyle.css">
    <link type="text/css" rel="stylesheet" href="/static/css/treeSelectStyle.css">
    <script src="/static/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery.ztree.all.js"></script>
    <script type="text/javascript" src="/static/js/treeSelect.2.0.js"></script>
    <script type="text/javascript" src="/static/js/xm-select.js"></script>
</head>
<body>
<div class="ok-body">
    <!--form表单-->
    <form class="layui-form layui-form-pane ok-form">
        <div class="layui-row layui-col-space10">
        <div class="layui-inline layui-col-md12">
            <label class="layui-form-label">意见简略<span style="color: red">*</span></label>
            <div class="layui-input-block">
                <input type="text" name="opinion_name" id="opinion_name" placeholder="请输入意见简略！" autocomplete="off" class="layui-input"
                       lay-verify="required">
                <input type="text" name="id" id="id" class="layui-input" style="display: none">
            </div>
        </div>
        </div>
        <div class="layui-form-item layui-form-text" style="padding-top: 10px;">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark_describe" id="remark_describe" placeholder="请输入备注内容" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="edit">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" id="close">关闭</button>
            </div>
        </div>
    </form>
</div>
<!--js逻辑-->
<script type='text/javascript'>
    let data1;

    function child(d) {
        data1 = d;


    layui.use(["form", "okUtils", "form", "tree", "okLayer"], function () {
        let $ = layui.$;
        let form = layui.form;
        let okUtils = layui.okUtils;
        let okLayer = layui.okLayer;
        let tree = layui.tree;
        let util = layui.util;
        okLoading.close();
        $('#id').val(data1.id);
        $('#opinion_name').val(data1.opinion_name);
        $('#remark_describe').val(data1.remark_describe);

        form.on("submit(edit)", function (data) {
            console.log(data.field.id)
            okUtils.ajax("/project/opinion_edit/" + data.field.id, "post", data.field, true).done(function (response) {
                okLayer.greenTickMsg(response.msg, function () {
                    window.parent.location.reload();
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                });
            }).fail(function (error) {
                // 这里已经有提示了
            });
            return false;
        });
        $("#close").click(function () {
            let index = parent.layer.getFrameIndex(window.name); //获取当前窗口的name
            window.parent.location.reload();
            parent.layer.close(index);
        });
    })};
</script>
</body>
</html>
